%%%-------------------------------------------------------------------
%%% File    : hiberl_test.erl
%%% Author  : alfonso <alfonso@alfonso-laptop>
%%% Description : 
%%%
%%% Created : 17 Sep 2009 by alfonso <alfonso@alfonso-laptop>
%%%-------------------------------------------------------------------
-module(hiberl_test).

-compile(export_all).

test()->
    Url = "DSN=world;UID=alfonso",
    Tables = ["CountryLanguage", "City", "Country"],

    %% First render the template with the table "country"
    ok = hiberl:render(hiberl_drv_mysql, "world", Url, Tables),

    %% Start odbc session
    hiberl_session:start_register(Url),

    F = fun(Table)->
		TableAtom = list_to_atom(hiberl_utils:low_first(Table)),
		%% Get all rows from the database
		Data = TableAtom:select(),
		%% Do a pretty print of the data    
		hiberl_utils:pp(Data,10)
	end,
    lists:map(F,Tables),

    %% Terminate with the session
    hiberl_session:terminate(),

    ok.

